import request from '@/utils/request'
import qs from "qs"
export default {

    //分页获取运费模板列表 (get请求只能用params:{}来传递参数)
    listAll() {
        return request({
            url: '/api-sys/carriage-template/templates/available/all',
            method: 'get'
        })
    },
    //分页获取运费模板列表 (get请求只能用params:{}来传递参数)
    pageList(pageNum, pageSize, sort) {
        return request({
            url: '/api-sys/carriage-template/templates',
            method: 'get',
            params: { pageNum, pageSize, sort }
        })
    },
    //根据id删除运费模板数据
    deleteById(id) {
        return request({
            url: `/api-sys/carriage-template/template/${id}`,
            method: 'delete'
        })
    },
    //根据id批量操作运费模板数据
    batchOperation(ids, type) {
        var data = qs.stringify({ ids, type })
        return request({
            url: `/api-sys/carriage-template/templates`,
            method: 'post',
            data
        })
    },
    //根据id修改数据
    updateEnabledById(id,enabled) {
        var data = qs.stringify({id,enabled})
        return request({
            url: '/api-sys/carriage-template/template/updateEnabled',
            method: 'put',
            data
        })
    },
    //根据id修改数据
    updateById(formData) {
        var data = qs.stringify(formData)
        return request({
            url: '/api-sys/carriage-template/template',
            method: 'put',
            data
        })
    },
    // 添加运费运费模板
    addFreight(formData) {
        var data = qs.stringify(formData)
        console.log(formData)
        return request({
            url: '/api-sys/carriage-template/template',
            method: 'post',
            data
        })
    }

}